﻿<!-- このコードは、KWEST Developer's Groupに属し -->
<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dc="clr-namespace:Password_Generator"
        Title="{Binding Path= BuildDate, Mode=OneWay}"
        Height="356"
        Width="450"
        WindowStartupLocation="CenterScreen"
        ResizeMode="CanMinimize"
        Loaded="Window_Loaded"
        Closing="Window_Closing" 
        Icon="/Password Generator;component/Resources/KDG_Logo.png">




    <!--Styles in this file are defined under Resources/resources.xaml-->
    <!--Main grid.  There are four rows and two columns.-->
    <Grid Background="WhiteSmoke">
        <Grid.RowDefinitions>
            <RowDefinition Height="35*" />
            <RowDefinition Height="180*" />
            <RowDefinition Height="70*" />
            <RowDefinition Height="85*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <!--Application menu.-->
        <Menu IsMainMenu="True"
              Grid.Row="0"
              Grid.ColumnSpan="2"
              Style="{DynamicResource CustomMenu}">
            <MenuItem Header="_File">
                <MenuItem x:Name="menuExit"
                          Header="_Exit"
                          Click="btnExit_Click"/>
            </MenuItem>
            <MenuItem Header="_About">
                <MenuItem x:Name="menuAbout"
                          Header="_Project"
                          Click="menuAbout_Click"/>
                <!--<MenuItem x:Name="menuDocs"
                          Header="_Documentation" />-->
            </MenuItem>
        </Menu>

        <!--Left side panels (3).-->
        <StackPanel Orientation="Vertical"
                    Grid.Row="1"
                    Grid.Column="0"
                    HorizontalAlignment="Center"
                    Margin="0,0,0,0">
            <Label Content="Options"
                   Style="{DynamicResource CustomLabel}"/>
        </StackPanel>
        <StackPanel Grid.Column="0"
                    Grid.Row="1"
                    Orientation="Horizontal"
                    HorizontalAlignment="Center"
                    Margin="0,37,0,0">

            <StackPanel>
                <Label Content="Letters"
                       x:Name="lblLetters"/>
                <Label Content="Numbers"
                       x:Name="lblNumbers"/>
                <Label Content="Symbols"
                       x:Name="lblSymbols"/>
            </StackPanel>
            <StackPanel Margin="0,0,0,43"
                        Width="14">

                <CheckBox x:Name="checkLetters"
                          Style="{DynamicResource CustomCheck}"
                          Margin="0,7,0,0"
                          IsChecked="{Binding Path=Letters, Mode=TwoWay}"
                          Unchecked="check_Unchecked" />


                <CheckBox x:Name="checkNumbers"
                          Style="{DynamicResource CustomCheck}"
                          Margin="0,13,0,0"
                          IsChecked="{Binding Path=Numbers, Mode=TwoWay}"
                          Unchecked="check_Unchecked"/>


                <CheckBox x:Name="checkSymbols"
                          Style="{DynamicResource CustomCheck}"
                          Margin="0,13,0,0"
                          IsChecked="{Binding Path=Symbols, Mode=TwoWay}"
                          Unchecked="check_Unchecked"/>



            </StackPanel>
        </StackPanel>

        <!--Right side panels (3)-->
        <StackPanel Grid.Row="1"
                    Grid.Column="1"
                    HorizontalAlignment="Center"
                    Margin="0,0,0,0">
            <Label Content="Size"
                   Style="{DynamicResource CustomLabel}" />
        </StackPanel>
        <StackPanel Grid.Column="1"
                    Grid.Row="1"
                    Orientation="Horizontal"
                    HorizontalAlignment="Center"
                    Margin="0,37,0,0">

            <StackPanel>
                <TextBlock
                       Margin="0,5,0,0" 
                       TextAlignment="Right">
                    Size of password<LineBreak />
                    (3-20)
                </TextBlock>
                <Label Content="Copy to clipboard"
                       Margin="0,5,0,0" />
            </StackPanel>

            <StackPanel Width="30" Margin="0,0,0,47">

                <TextBox Margin="2,12,0,0"
                         x:Name="txtLimit"
                         MaxLength="2"
                         Width="20"
                         Style="{DynamicResource CheckError}">
                    <TextBox.Text>
                        <Binding Path="Limit" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
                            <Binding.ValidationRules>
                                <dc:LimitValidate  />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>


                <CheckBox Style="{DynamicResource CustomCheck}"
                          Margin="9,21,0,0"
                          x:Name="checkClip"
                          IsChecked="{Binding Path=Clipboard, Mode=TwoWay}"
                          Checked="checkClip_Checked"/>
            </StackPanel>
        </StackPanel>

        <!--Output textbox-->
        <TextBox x:Name="txtOutput"
                   Grid.Row="2"
                   Grid.ColumnSpan="2"
                 FontWeight="SemiBold"
                 FontSize="15"
                 Background="WhiteSmoke"
                 BorderBrush="Transparent"
                 TextAlignment="Center"
                 Margin="35,10,35,10"
                 IsReadOnly="True"
                 Text="{Binding Path=Password, Mode=OneWay}"/>

        <!--Bottom buttons-->
        <Button x:Name="btnGenerate"
                Style="{DynamicResource btnThree}"
                Content="Generate"
                Grid.Row="3"
                Margin="19,10,21,20"
                Click="btnGenerate_Click"/>
        <Button x:Name="btnExit"
                Style="{DynamicResource btnTwo}"
                Content="Exit"
                Grid.Row="3"
                Grid.Column="1"
                Margin="19,10,21,20"
                Click="btnExit_Click"/>
    </Grid>
</Window>
